const mysql = require('mysql'),
  log = require('./log'),
  config = require('./config');

if (config.is_debug) {
  exports.query = (sql, paras, resolve) => {
    if (sql.indexOf('select * from url') == 0) {
      resolve(null, [{
        id: 1,
        url: 'https://zoro.site',
        title: 'zoro',
        p: 1
      }])
    } else {
      resolve(new Error('不能执行' + sql))
    }
  }
} else {
  module.exports = mysql.createPool({
    connectionLimit: 10,
    host: '123.56.115.107',//'139.129.45.92',//'127.0.0.1', //主机
    user: 'zoro',//'root', //MySQL认证用户名
    password: '<SB>buyaodenglu',//'root', //MySQL认证用户密码
    port: '3306', //端口号
    database: 'zoro'
  });
}
